<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<script type="text/javascript">
            function validation(obj) 
            {
            	
            	var return_value = true;
            	var str, reg, msg_err="";
            	
            	var idArray = new Array("login","pass");
            	var idReg = new Array(/^[A-Za-z0-9]+$/,
            						  /^[A-Za-z0-9]+$/);
         		
                for (var i=0; i<2; i++) {
               		str=document.getElementById(idArray[i]).value;
              	  	if(RegExp(idReg[i]).exec(str) == null) {
              	  	    document.getElementById("err"+idArray[i]).value='не верный ввод';
                    	return_value = false;
              	  	}
              	  	else 
              	  		document.getElementById("err"+idArray[i]).value=' ';
              	}
                return return_value;
            }
</script>

	<form:form method="POST" commandName="user" onsubmit="return validation(this)" action="/CoffiSweetDreams/index.htm?action=registration">
		<div align="center">
			<table id="data" cellspacing="0" cellpadding="0" width="420">
				<tr>
					<td class="box_top_left"></td>
					<td class="box_top_centr"></td>
					<td class="box_top_centr" width="300px"></td>
					<td class="box_top_right"></td>
				</tr>
				<tr>
					<td height="35" class="box_left"></td>
					<td colspan="2" height="35" bgcolor="f8be93">
						<div class="user">Регистрация</div>
					</td>
					<td height="35" class="box_right"></td>
				</tr>
				<tr>
					<td class="box_left"></td>
					<td class="main" height="18px">Логин:</td>
					<td width="300" class="main" align="left">
						<form:input	class="inputbox" path="login" id="login" /> ${checkLogin} <input type="text" class="err" readonly id="errlogin" />
					</td>
					<td class="box_right"></td>
				</tr>
				<tr>
					<td class="box_left"></td>
					<td class="main" height="18px">Пароль:</td>
					<td width="300" class="main">
						<form:input class="inputbox" path="pass" type="password" id="pass" /> <input type="text" class="err" readonly id="errpass" />
					</td>
					<td class="box_right"></td>
				</tr>

				<tr>
					<td class="box_left"></td>
					<td colspan="2" height="35" bgcolor=f8be93 align="center"></td>
					<td class="box_right"></td>
				</tr>

				<tr>
					<td class="box_left"></td>
					<td colspan="2" height="35" bgcolor=f8be93 align="center">
						<input type="image" src="/CoffiSweetDreams/butttons/reg.png" value="submit"></td>
					<td class="box_right"></td>
				</tr>
				<tr>
					<td class="box_left"></td>
					<td colspan="2" height="35" bgcolor=f8be93 align="center">
						<br/>
						<a href="index.htm">
							<img border="0" src="/CoffiSweetDreams/butttons/home.png" width="200" height="30">
						</a>
					</td>
					<td class="box_right"></td>
				</tr>
				<tr>
					<td class="box_bottom_left"></td>
					<td class="box_bottom_centr"></td>
					<td class="box_bottom_centr" width="300px"></td>
					<td class="box_bottom_right"></td>
				</tr>
			</table>
		</div>
	</form:form>
